package com.anjubao.parking.municipal.parkinglot.feign;

import com.anjubao.parking.municipal.common.dto.ApiResult;
import com.anjubao.parking.municipal.parkinglot.dto.*;
import com.anjubao.parking.municipal.parkinglot.form.AreaScreeningParkingLotForm;
import com.anjubao.parking.municipal.parkinglot.form.ParkingLotBillRuleForm;
import com.anjubao.parking.municipal.parkinglot.form.ParkingLotSlotScreeningForm;
import com.anjubao.parking.municipal.parkinglot.form.PositionScreeningParkingLotForm;
import io.swagger.annotations.*;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author anjubao
 */
public interface ParkingLotFeignService {

    /**
     * 获取停车场详细信息接口
     *
     * @param parkingLotCode 停车场code
     * @return
     */
    @GetMapping("/feign/parking-lots/{parkingLotCode}")
    ApiResult<ParkingLotDto> getParkingLot(@PathVariable String parkingLotCode);

    /**
     * 根据泊位编号查询泊位记录
     *
     * @param code
     * @return
     */
    @GetMapping("/feign/parking-lots-slots/{code}")
    ApiResult<ParkingLotSlotDto> getParkingLotSlotByCode(@PathVariable String code);

    /**
     * 根据泊位code获取停车场信息
     *
     * @param parkingLotSlotCode
     * @return
     */
    @GetMapping("/feign/parking-lots-slots/by-parking-lot-slot-code")
    ApiResult<ParkingLotGeomagneticStatusDto> getParkingLotByParkingLotSlotCode(@RequestParam(name = "parkingLotSlotCode") String parkingLotSlotCode);

    /**
     * 根据泊位编号查询泊位记录
     *
     * @param parkingLotSlotName
     * @return
     */
    @GetMapping("/feign/parking-lots-slots/getParkingLotSlotIdsByName")
    ApiResult<List<ParkingLotSlotDto>> getParkingLotSlotIdsByName(@RequestParam(required = false, name = "parkingLotSlotName") String parkingLotSlotName);


    /**
     * 根据停车场id获取剩余车位
     *
     * @param parkingLotIds
     * @return
     */
    @GetMapping("/feign/parking-lots-status/getSlotStatByParkingLot")
    ApiResult<List<ParkingLotStatusDto>> getSlotStatByParkingLot(@RequestParam(name = "parkingLotIds") List<String> parkingLotIds);

    /**
     * 更新停车位数据接口
     *
     * @param code
     * @param status
     * @return
     */
    @PutMapping("/feign/parking-lots-slots-status/{code}")
    ApiResult<ParkingLotSlotReturnDto> updateParkingLotSlotsStatus(@PathVariable String code, @RequestBody @Valid @ApiParam(value = "车位状态") Integer status);

    /**
     * 修改停车场空闲车位信息
     *
     * @param parkingLotCode
     * @param freeSlots
     * @return
     */
    @PutMapping("/feign/parking-lots-free/{parkingLotCode}")
    ApiResult<ParkingLotReturnCodeDto> updateParkingLotFree(@PathVariable String parkingLotCode, @RequestBody @Valid Integer freeSlots);

    /**
     * 停车场列表
     *
     * @param form
     * @return
     */
    @GetMapping("/feign/areas")
    ApiResult<List<ParkingLotDto>> areaScreeningParkingLot(@RequestBody AreaScreeningParkingLotForm form);

    /**
     * 获取泊位数据,并分页
     * @param form
     * @return
     */
    @GetMapping("/feign/parking-lots-slots")
    ApiResult<List<ParkingLotSlotDto>> getParkingLotSlots(@RequestBody ParkingLotSlotScreeningForm form);

    /**
     * 获取停车总费用
     */
    @GetMapping("/feign/parking-lots-bill-rules/parking-total-fee")
    @ApiOperation("计算停车总费用")
    ApiResult<ParkingTotalFeeDto> getParkingTotalFee(@ApiParam(value = "停车场code",required = true) @RequestParam(value = "parkingLotCode",required = true) String parkingLotCode,
                                                     @ApiParam(value = "进场时间",required = true) @RequestParam(value = "enterTime",required = true) LocalDateTime enterTime,
                                                     @ApiParam(value = "离场时间",required = true) @RequestParam(value = "leaveTime",required = true) LocalDateTime leaveTime);

    /**
     * 获取停车总费用
     */
    @GetMapping("/feign/parking-lots-bill-rules/parking-total-fee-string")
    @ApiOperation("计算停车总费用")
    ApiResult<ParkingTotalFeeDto> getParkingTotalFeeWithString(@ApiParam(value = "停车场code",required = true) @RequestParam(value = "parkingLotCode",required = true) String parkingLotCode,
                                                               @ApiParam(value = "进场时间",required = true) @RequestParam(value = "enterTime",required = true) String enterTime,
                                                               @ApiParam(value = "离场时间",required = true) @RequestParam(value = "leaveTime",required = true) String leaveTime);

    /**
     * 获取停车总费用
     */
    @PostMapping("/feign/parking-lots-bill-rules/parking-total-fee/batch")
    @ApiOperation("批量计算停车总费用")
    ApiResult<List<ParkingTotalFeeDto>> getParkingTotalFeeBatch(@RequestBody List<ParkingTotalFeeDto> totalFeeList);

    @GetMapping("/feign/find-parking-lot")
    @ApiOperation(value = "4.1.4根据经纬度筛选停车场信息接口/找车位")
    ApiResult<List<ParkingLotDto>> findParkingLot(@ApiParam(value = "latitude",required = true) @RequestParam(value = "latitude",required = true) Double latitude,
                                                  @ApiParam(value = "longitude",required = true) @RequestParam(value = "longitude",required = true) Double longitude);

    @GetMapping("/feign/parkinglot/search")
    @ApiOperation(value = "搜索停车场")
    ApiResult<List<ParkingLotDto>> searchParkinglot(@ApiParam(value = "停车场名称/位置",required = true) @RequestParam(value = "name",required = true) String name,
                                                    @ApiParam(value = "latitude",required = true) @RequestParam(value = "latitude",required = true) Double latitude,
                                                    @ApiParam(value = "longitude",required = true) @RequestParam(value = "longitude",required = true) Double longitude);

    @GetMapping("/feign/parkinglot/billrule")
    @ApiOperation(value = "通过停车位查询计费规则")
    ApiResult<ParkingLotBillRuleDto> getBillRule(@ApiParam(value = "车位编号",required = true) @RequestParam(value = "parkinglotSlotName",required = true) String parkinglotSlotName);

    /**
     * 批量更新停车场空闲车位信息
     * @param parkingLotStatusDtoList
     * @return
     */
    @PutMapping("/feign/parking-lots-free/list")
    ApiResult<Integer> updateParkingLotFreeList(@RequestBody List<ParkingLotStatusDto> parkingLotStatusDtoList);




}

